﻿using System;
using System.Data;
using System.Data.Common;
using MySql.Data.MySqlClient;

namespace Bpms.Data.MySql
{
    public class MySqlProvider : IDbProvider
    {
        public DbProviderFactory Instance()
        {
            return MySqlClientFactory.Instance;
        }

        public string GetLastIdSql()
        {
            return "SELECT LAST_INSERT_ID()";
        }

        public DbParameter MakeParam(string ParamName, DbType DbType, Int32 Size)
        {
            MySqlParameter param;

            if (Size > 0)
                param = new MySqlParameter(ParamName, (MySqlDbType)DbType, Size);
            else
                param = new MySqlParameter(ParamName, (MySqlDbType)DbType);

            return param;
        }

        public int GetId(string fieldName, string tableName, string condition)
        {

            return 1;
        }
    }
}
